package com.hpeu_01.day0119.homework;

import java.util.Collection;
import java.util.HashMap;
import java.util.Map;
import java.util.Set;

public class HomeWork03 {
    public static void main(String[] args) {
        Map ht = new HashMap();
        ht.put("CA","加拿大");
        ht.put("CF","中非");
        ht.put("CG","刚果");
        ht.put("CH","瑞士");
        ht.put("CL","智利");
        ht.put("CM","喀麦隆");
        ht.put("CN","中国");
        ht.put("CO","哥伦比亚");
        ht.put("CR","哥斯达黎加");
        ht.put("CS","捷克");
        ht.put("CU","古巴");
        ht.put("CY","塞浦路斯");
        ht.put("DE","德国");
        ht.put("DK","丹麦");
        ht.put("DO","多米尼加共和国");
        ht.put("DZ","阿尔及利亚");

        boolean ca = ht.containsKey("CA");
        if (ca){
            System.out.println(ht.get("CA"));
        }else {
            System.out.println("无此国家");
        }
        System.out.println("一共有"+ht.size()+"个国家");
        System.out.println("所有国家简称:");
        Set set = ht.keySet();
        for (Object o : set) {
            System.out.print(o+" ");
        }
        System.out.println();
        System.out.println("所有国家值:");
        Collection values = ht.values();
        for (Object value : values) {
            System.out.print(value+" ");
        }
    }
}
